package com.assignwork.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDate;
import java.util.List;

@Data
public class WorkArrangeInfoVO {

    @JsonFormat(pattern = DateUtil.PATTERN_DATE)
    @DateTimeFormat(pattern = DateUtil.PATTERN_DATE)
    private LocalDate planDate;

    private String shipName;

    private String shipBerthKey;
    private String shipBerthName;
    
    private String lineNo;

    private String timeSpace;
    private String timeSpaceName;

    private String cargoType;
    private String cargoTypeName;

    private String packageBulk;
    private String packageBulkName;
    
    private String workerInfo;
    private String craneInfo;
    private String forkliftInfo;
    private String tractorInfo;
    private String loaderInfo;
    private String excavatorInfo;
    private String supportMachineCorp;
    private String supportMachineCorpName;
    private String supportMachineKind;
    private String supportMachineKindName;
    @JsonSerialize(using = ToStringSerializer.class, nullsUsing = NullSerializer.class)
    private Long fixedMachineId;
    private String realCabin1;
    private String realCabin1Name;
    private String realHatch1;
    private String realHatch1Name;
    private String realCabin2;
    private String realCabin2Name;
    private String realHatch2;
    private String realHatch2Name;
    private String shipMachineryCount;
    @JsonSerialize(using = ToStringSerializer.class, nullsUsing = NullSerializer.class)
    private Long teamId;
    private String teamName;
    private String workers;
    List<WorkArrangeUnderInfoVO> underInfo;
    @JsonSerialize(using = ToStringSerializer.class)
    private Long updateUser;
    private String sign;

    private AssignWorkVO assignWork;

    public String getRealCabinHatchName1() {
        if (Func.isNotBlank(realCabin1Name) && !"ALL".equals(realHatch1)) {
            return realCabin1Name + realHatch1Name;
        }
        return realCabin1Name;
    }
    public String getRealCabinHatchName2() {
        if (Func.isNotBlank(realCabin2Name) && !"ALL".equals(realHatch2)) {
            return realCabin2Name + realHatch2Name;
        }
        return realCabin2Name;
    }

}
